//
//  RZConversationDataSource.h
//  RZIM
//
//  Created by reyzhang on 2021/8/19.
//  对聊天会话数据源的加工及处理 封装

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN
@class YMMessage;
@class YMConversation;
@class YMConversationViewController;
@class YMMessageInfo;

@interface YMConversationDataSource : NSObject

- (instancetype)init:(YMConversationViewController *)chatVC;

//是否所有消息都已经加载完成
@property (nonatomic, assign, readonly) BOOL allMessagesAreLoaded;

//显示查看未读的消息 id
@property (nonatomic, assign, readonly) long long showUnreadViewMessageId;

//聊天页面上下滑动加载更多消息时，当有菊花转时，该值为 yes，加载消息完成后为 no，避免频繁滑动加载过快
@property (nonatomic, assign, readonly) BOOL isIndicatorLoading;

//是否正在加载历史消息
@property (nonatomic, assign, readonly) BOOL isLoadingHistoryMessage;

// 用于统计在当前页面时右下角未读数的显示
@property (nonatomic, strong) NSMutableArray *unreadNewMsgArr;


//进入聊天页面初次加载的消息
- (void)getInitialMessage:(YMConversation *)conversation;

- (void)loadLatestHistoryMessage;

//聊天页面滚动到顶部再拉历史消息调
- (void)loadMoreHistoryMessageIfNeed;

- (void)scrollToLoadMoreHistoryMessage;


/**
 根据控制器的设置 ，来改变模型对于是否显示昵称的控制
 */
- (YMMessageInfo *)setModelIsDisplayNickName:(YMMessageInfo *)model;


#pragma mark - Notification
//处理聊天页面收到的消息
- (void)didReceiveMessageNotification:(YMMessage *)rzMessage;
@end

NS_ASSUME_NONNULL_END
